<template>
	<view class="all">
		<view class="all_centent_2">
			<view class="carp" :style="{
			'border-top':index==0?'1rpx solid #EFEFEF':'',
			'border-bottom':index!=list.length-1?'1rpx solid #EFEFEF':''
			}" @click="submit(item)" v-for="(item,index) in list">
				<text class="text_1">{{item.name}}</text>
				<view class="carp_1">
					<text v-if="item.text">{{item.text}}</text>
					<u-icon name="arrow-right" size="25" color='#91969A ' />
				</view>
			</view>
		</view>
		<view class="jiange">
		</view>
		<view style="padding: 0 20rpx 0 20rpx;" @click="tuichu">
			<view class="carp" :style="{
				'border-bottom':'1rpx solid #EFEFEF'
				}" @click="submit">
				<text class="text_1" style="color:#FFB300 ;">退出登录</text>
				<view class="carp_1">
					<u-icon name="arrow-right" size="25" color='#91969A ' />
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						name: "账号与安全",
						text: ''
					},
					{
						name: "我的地址",
						text: ''
					},
					{
						name: "提现设置",
						text: ''
					},
					{
						name: "关注公众号",
						text: ''
					},
					{
						name: "关于我们",
						text: ''
					},
					{
						name: "版本号",
						text: '当前版本V1.1.2'
					},
				]
			}
		},
		onLoad() {
			// 版本号
			this.$api('usermsg/about').then(res => {
				this.list.forEach(v => {
					if (v.name == '版本号') {
						v.text = '当前版本v' + res.data.edition
					}
				})
			})
		},
		methods: {
			tuichu() {
				this.$api('user/logout').then(res => {
					this.$toast(res.msg, 1)
					uni.reLaunch({
						url: '../../login/login'
					})
					uni.removeStorageSync('token')
				})
			},
			submit(a) {
				switch (a.name) {
					case '账号与安全':
						uni.navigateTo({
							url: './zhanghao'
						})
						break;
					case '提现设置':
						uni.navigateTo({
							url: './txsz'
						})
						break;
					case '关注公众号':
						uni.navigateTo({
							url: './gzh'
						})
						break;
					case '关于我们':
						uni.navigateTo({
							url: './gywm'
						})
						break;
					case '我的地址':
						uni.navigateTo({
							url: './dizhi'
						})
						break;
					default:
				}
			}
		}
	}
</script>

<style lang="scss">
	.all {
		.all_centent_2 {
			padding: 0rpx 30rpx 0rpx 30rpx;
		}

		.carp:active {
			background-color: rgba($color: #999999, $alpha: 0.1);
		}

		.jiange {
			height: 15rpx;
			background-color: #F6F6F6;
		}

		.carp {
			// border-bottom: 1rpx solid #EFEFEF;
			padding: 35rpx 0 35rpx 0;
			display: flex;
			justify-content: space-between;

			.carp_1 {
				text {
					font-size: 26rpx;
					font-family: Source Han Sans CN;
					color: #999999;
					margin-right: 10rpx;
					opacity: 1;
				}
			}

			.text_1 {
				font-size: 30rpx;
				font-family: Source Han Sans CN;
				color: #333333;
				font-weight: 600;
				opacity: 1;
			}
		}
	}
</style>
